@extends('PShop::layout')
@push('styles')
    <style type="text/css">

    </style>
@endpush
@section('content')
    <section class="wapper">
        <div class="base-w">
            <div class="">
                <ol class="am-breadcrumb am-margin-bottom-0 am-padding-top-sm am-padding-bottom-sm">
                    <li><a href="#">首页</a></li>
                    <li class="am-active"><a href="#">订单</a></li>
                </ol>
            </div>
            <div class="am-g">
                @include('PShop::public.user_nav')
                <div class="am-u-md-9 am-u-lg-10 am-padding-0">
                    <div class="am-bg-white order-list-panel am-padding-top-sm">
                        <div data-am-widget="tabs" class="am-tabs am-tabs-d2 am-margin-0">
                            <ul class="am-tabs-nav am-cf mui-fenlei">
                                <!--此处不建议加 a 标签，禁用框架自带tab切换效果-->

                                <li style="cursor: pointer" data-url="{{route('f_Pc_Order_orderList')}}" class="flex-item  {{$status===false?'am-active':''}}">全部订单 </li>
                                <li style="cursor: pointer" data-url="{{route('f_Pc_Order_orderList')}}" class="flex-item {{$status===0?'am-active':''}}">待付款</li>
                                <li style="cursor: pointer" data-url="{{route('f_Pc_Order_orderList',['status'=>1])}}" class="flex-item {{$status==1?'am-active':''}}">待发货</li>
                                <li style="cursor: pointer" data-url="{{route('f_Pc_Order_orderList',['status'=>2])}}" class="flex-item {{$status==2?'am-active':''}}">待收货</li>
                                <li style="cursor: pointer" data-url="{{route('f_Pc_Order_orderList',['status'=>3])}}" class="flex-item {{$status==3?'am-active':''}}">已完成</li>
                            </ul>
                            <div class="am-tabs-bd am-padding-xs">
                                <div data-tab-panel-0 class="am-tab-panel am-active">
                                    @foreach($list as $item)
                                    <div class="item-list am-panel am-panel-default">
                                        <div class="am-panel-hd am-vertical-align">
                                            <div class="am-inline-block am-u-sm-8">
                                                <span class="am-padding-right">{{$item->created_at}}</span>
                                                <span>订单编号：{{$item->order_sn}}</span>
                                            </div>
                                            <div class="am-inline-block  am-u-sm-4">
                                                <span>订单编号：{{$item->order_sn}}</span>
                                            </div>
                                        </div>
                                        <div class="am-panel-bd">
                                            <div class="am-ub am-ub-f1 am-u-md-8 am-u-lg-8">
                                                <ul class="am-ub am-ub-f1 am-ub-ver">
                                                    @foreach($item->goods as $goods)
                                                    <li class="am-ub am-ub-f1 am-ub-ac">
                                                        <div class="am-ub am-ub-f2">
                                                            <div class="am-ub am-ub-img goods-wh am-margin-right-sm"
                                                                 style="background-image: url({{$goods->goods_img}});">
                                                            </div>
                                                            <div class="am-ub am-ub-ver am-ub-pc am-ut-s">
                                                                {{$goods->goods_name}}
                                                                <em class="am-padding-left-xs">{{$goods->goods_spec}}</em>
                                                            </div>
                                                        </div>
                                                        <div class="am-ub am-ub-f1">X{{$goods->number}}</div>
                                                        <div class="am-ub am-ub-f1">￥{{number_format($goods->pay_money,2)}}</div>
                                                    </li>
                                                    @endforeach
                                                </ul>
                                            </div>
                                            <div class="am-ub am-ub-f1 am-ub-ac am-u-md-4 am-u-lg-4 am-padding-left-0">
                                                <div class="am-ub am-ub-f1 am-text-danger am-blod">
                                                    ￥{{$item->pay_price}}元<br/>
                                                    @if($item->goods_zone == 2)
                                                    (抵扣{{json_decode(get_rule('pingji_award'))}}折)
                                                    @endif
                                                </div>
                                                <div class="am-ub am-ub-ver am-ub-f1 am-ub-ac" style="margin-top: -0.5rem;">
                                                    @if($item->status == 0)
                                                        <a href="{{route('f_Pc_Order_orderPay',['order_sn'=>$item->order_sn])}}" class="am-ub am-ub-pc am-btn am-btn-sm am-btn-danger am-radius">付款</a>
                                                        <a href="javascript:;" data-action="{{route('f_Pc_Order_cancel',['order_sn'=>$item->order_sn])}}"
                                                           class="am-ub am-ub-pc am-text-xs am-link-muted am-margin-top-xs order-cancel">取消订单
                                                        </a>
                                                        <a href="javascript:;"
                                                           data-action="{{route('f_Pc_Order_delete',['order_sn'=>$item->order_sn])}}"
                                                           class="am-ub am-ub-pc am-text-xs am-link-muted am-margin-top-xs order-del">删除订单
                                                        </a>
                                                    @elseif($item->status == 1)
                                                        <a href="javascript:;" class="am-ub am-ub-pc am-text-xs am-link-muted am-margin-top-xs">待发货</a>
                                                    @elseif($item->status == 2)
                                                        <a href="javascript:;" data-action="{{route('f_Pc_Order_confirmOrder',['order_sn'=>$item->order_sn])}}" class="am-ub am-ub-pc am-btn am-btn-sm am-btn-confirm am-radius order-confirm">确认收货</a>
                                                    @elseif($item->status == 3)
                                                        <a href="#" class="am-ub am-ub-pc am-text-xs am-link-muted">已收货</a>
                                                    @elseif($item->status == -1)
                                                        <a href="javascript:;" class="am-ub am-ub-pc am-text-xs am-link-muted">订单关闭</a>
                                                    @endif
                                                    <a href="{{route('f_Pc_Order_detailOrder',['order_id'=>$item->order_id])}}" class="am-ub am-ub-pc am-text-xs am-margin-top-xs">查看详情</a>

                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    @endforeach
                                </div>

                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>
@endsection
@push('scripts')
    <script src="{{asset(config('mall.pc_assets').'/js/order.js')}}"></script>
<script>
    $('.mui-fenlei .flex-item').each(function () {
        $(this).off('tap').on('click',function () {
            window.location.href =  $(this).data('url');
        });
    });
</script>
@endpush